how to calculate permutation in string

visit shbcf.ru